package com.hexiang.service;

import com.hexiang.dao.EmployeeDao;
import com.hexiang.po.Employee;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@Slf4j
public class EmployeeService {

	@Resource
	private EmployeeDao employeeDao;

	@Cacheable(cacheNames = "employee")
	public List<Employee> findAll() {
		log.info("查询所有员工......");
		return employeeDao.findAll();
	}

	@Cacheable(cacheNames = "employee--id")
	public Employee selectEmp(Integer id) {
		log.info("查询员工:" + id);
		return employeeDao.selectById(id);
	}

}
